﻿using System;

using System.Collections.Generic;
using System.Text;

namespace Handrise.Mobile.BasicModal.GPS
{
    /// <summary>
    /// 度分秒格式的经纬度
    /// </summary>
    public class DMSPosition
    {
        int degrees;
        /// <summary>
        /// 度
        /// </summary>
        public int Degrees
        {
            get { return degrees; }
        }

        int minutes;
        /// <summary>
        /// 分
        /// </summary>
        public int Minutes
        {
            get { return minutes; }
        }

        double seconds;
        /// <summary>
        /// 秒
        /// </summary>
        public double Seconds
        {
            get { return seconds; }
        }

        /// <summary>
        /// Constructs a new instance of DegreesMinutesSeconds converting 
        /// from decimal degrees
        /// </summary>
        /// <param name="decimalDegrees">Initial value as decimal degrees</param>
        //public DMSPosition(double decimalDegrees)
        //{
        //    degrees = (int)decimalDegrees;

        //    double doubleMinutes = (Math.Abs(decimalDegrees) - Math.Abs((double)degrees)) * 60.0;

        //    minutes = (int)doubleMinutes;
        //    seconds = (doubleMinutes - (double)minutes) * 60.0;
        //}

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="degrees">度</param>
        /// <param name="minutes">分</param>
        /// <param name="seconds">秒</param>
        public DMSPosition(int degrees, int minutes, double seconds)
        {
            this.degrees = degrees;
            this.minutes = minutes;
            this.seconds = seconds;
        }

       

        /// <summary>
        /// 将经纬度格式化为: D M' S"格式
        /// </summary>
        /// <returns>返回经纬度字符串</returns>
        public override string ToString()
        {
            return degrees + "d " + minutes + "' " + seconds + "\"";
        }


    }
}
